<script language="javascript" type="text/javascript">	
	$('.modifica').click(function() {
	   var var_name = $("input[name='Radio1']:checked").val();
	   var jrole = "utenti/moduser.php?id="+var_name;
        $('#ricerca').fadeOut(1000,function(){$('#ricerca').load(jrole,'',$('#ricerca').fadeIn(1000))}); 
		return false;
    }); 
	
	$('.cancella').click(function() {
	   var var_name = $("input[name='Radio1']:checked").val();
	   var jrole = "utenti/visualizza.php?del="+var_name;
        $('#ricerca').fadeOut(1000,function(){$('#ricerca').load(jrole,'',$('#ricerca').fadeIn(1000))}); 
		return false;
    }); 
    </script>

<?php
  require_once('../Connections/mlu.php');
if (isset($_GET['nickname']) && !isset($_GET['up']))
{
  $query_Recordset1 = "insert into operatori (nickname,password,nome,cognome,idgrado) values (";
  $query_Recordset1.=$_GET['nickname'].",".$_GET['password'].",".$_GET['nome'].",".$_GET['cognome'].",".$_GET['idgrado'].")";
  $Recordset1 = mysql_query($query_Recordset1, $mlu) or die(mysql_error());
}

if (isset($_GET['del']))
{
	$id=$_GET['del'];
	$query_Recordset1riclibri = "DELETE from operatori where idop=".$id;
 	mysql_query($query_Recordset1riclibri, $mlu) or die(mysql_error());
	
}

if (isset($_GET['up']))
{
	$id=$_GET['up'];
  $updateSQL = "UPDATE operatori SET nickname=".$_GET['nickname'].", password=".$_GET['password'].", nome=".$_GET['nome'].", cognome=".$_GET['cognome'].", idgrado=".$_GET['idgrado']." WHERE idop=".$id;

  $Result1 = mysql_query($updateSQL, $mlu) or die(mysql_error());
	
}

 $insertSQL = "select * from operatori join gradi using (idgrado) order by nickname";
  $Result1 = mysql_query($insertSQL, $mlu) or die(mysql_error());
  
  
 ?>
 <p>&nbsp;</p>
  <table border="1" class="tabellalibri">
  <tr>
  <th>&nbsp;</th>
  <th>Id operatore</th>
  <th>Nickname</th>
  <th>Nome</th>
  <th>Cognome</th>
  <th>grado</th>
  </tr>
  <?php while ($row_Recordset1riclibri = mysql_fetch_assoc($Result1))
  { ?>
	
    <tr>
    <td><input type="radio" id="res" value="<?php echo $row_Recordset1riclibri['idop']; ?>" name="Radio1"/></td>  
  <td><?php echo $row_Recordset1riclibri['idop']; ?></td>
  <td><?php echo $row_Recordset1riclibri['nickname']; ?></td>
  <td><?php echo $row_Recordset1riclibri['nome']; ?></td>
  <td><?php echo $row_Recordset1riclibri['cognome']; ?></td>
  <td><?php echo $row_Recordset1riclibri['typegrado']; ?> </td>
  </tr>
  
  <?php }?>
  </table>
<button class="modifica">Modifica</button>
<button class="cancella">Cancella</button>